﻿<!DOCTYPE html>
<html>
<head lang="en">
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <title>请求串的生成</title>

 <script type="text/javascript" src="libs/js/jquery.js"></script>
    <script type="text/javascript" src="libs/js/form/datePicker/WdatePicker.js"></script>
 <style type="text/css">
        .Countdiv
        {
            display: none;
        }
    </style>
</head>
<body>
<form action="http://localhost:8060/MyServer/service.php" method="post">
<table>
            <tbody>

            <tr>
                <td >
                    用户名：
                </td>
                <td >
                    <input type="text" value="test" id="partner" name="partner" >
                    当前日期：
                   <input type="text" id="datetime" name="datetime" class="date" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',alwaysUseStartDate: true })"
                      />
                </td>
            </tr>
            
            <tr>
<td >
          密码：
</td>
<td >
               <input type="text" id="pwd"  name="pwd"value="ZTO123"  >
          格式：               
<input type="text" id="style" name="style" value="json" >
             
</td>
</tr>
<tr>
<td >
          接口方法：
</td>
<td>                
 <select id="func" name="func" onchange="SeleChange()" >
                        <option value="order.batch_submit">order.batch_submit</option>
                        <option value="order.submit">order.submit</option>
                        <option value="order.cancel">order.cancel</option>
                        <option value="mail.counter">mail.counter</option>
                        <option value="mail.apply">mail.apply</option>
                        <option value="mail.trace">mail.trace</option>
                        <option value="mail.status">mail.status</option>
                    </select>
                   
                </td>

            </tr>
            
             <tr>
                <td>
                    请求内容：
                </td>
                <td style="padding-top: 3px; padding-bottom: 3px;">
                    <textarea style="width: 700px; height: 150px;" id="contentM" name="contentM"></textarea>
                    
                    <div class="Countdiv">
                        [{ "id": "130520142013234" ,"type": "" ,"tradeid": "2701843" ,"mailno": "1000000000016"
                        ,"sender": { "id": "130520142010" ,"name": "李琳" ,"company": "新南电子商务有限公司" ,"mobile":"13912345678"
                        ,"phone": "021-87654321" ,"area": "310118" ,"city": "上海市,上海市,青浦区","address": "华新镇华志路123号"
                        ,"zipcode": "610012" ,"email": "ll@abc.com" ,"im": "1924656234" ,"starttime": "2013-05-20
                        12:00:00" ,"endtime": "2013-05-20 15:00:00" } ,"receiver":{ "id": "130520142097"
                        ,"name": "杨逸嘉" ,"company": "逸嘉实业有限公司" ,"mobile": "13687654321" ,"phone": "010-22226789"
                        ,"area": "501022" ,"city": "四川省,成都市,武侯区" ,"address": "育德路497号" ,"zipcode": "610012"
                        ,"email": "yyj@abc.com" ,"im": "yangyijia-abc" } ,"items": [ { "id": "1234567" ,"name":
                        "迷你风扇" ,"category": "电子产品" ,"material": "金属" ,"size":"12,11,23" ,"weight": "0.752"
                        ,"unitprice": "79" ,"url": "http://www.abc.com/123.html" ,"quantity": "1" ,"remark":
                        "黑色大号" } ,{ "name": "USB3.0集线器" ,"quantity": "1" ,"remark":"" } ] ,"weight": "0.753"
                        ,"size": "12,23,11" ,"quantity": "2" ,"price": "126.50","freight": "10.00" ,"premium":
                        "0.50" ,"pack_charges": "1.00" ,"other_charges":"0.00" ,"order_sum": "0.00" ,"collect_moneytype":
                        "CNY" ,"collect_sum": "12.00","remark": "请勿摔货" },{ "id": "130520142013232" ,"type":
                        "" ,"tradeid": "2701843" ,"mailno": "1000000000016" ,"sender": { "id": "130520142010"
                        ,"name": "李琳" ,"company": "新南电子商务有限公司" ,"mobile": "13912345678" ,"phone": "021-87654321"
                        ,"area": "310118" ,"city": "上海市,上海市,青浦区" ,"address": "华新镇华志路123号" ,"zipcode": "610012"
                        ,"email": "ll@abc.com" ,"im": "1924656234" ,"starttime": "2013-05-20 12:00:00" ,"endtime":
                        "2013-05-20 15:00:00" } ,"receiver": { "id": "130520142097" ,"name": "杨逸嘉" ,"company":
                        "逸嘉实业有限公司" ,"mobile": "13687654321" ,"phone": "010-22226789" ,"area": "501022" ,"city":
                        "四川省,成都市,武侯区" ,"address": "育德路497号" ,"zipcode": "610012" ,"email": "yyj@abc.com"
                        ,"im": "yangyijia-abc" } ,"items": [ { "id": "1234567" ,"name": "迷你风扇" ,"category":
                        "电子产品" ,"material": "金属" ,"size": "12,11,23" ,"weight": "0.752" ,"unitprice": "79"
                        ,"url": "http://www.abc.com/123.html" ,"quantity": "1" ,"remark": "黑色大号" } ,{ "name":
                        "USB3.0集线器" ,"quantity": "1" ,"remark": "" } ] ,"weight": "0.753" ,"size": "12,23,11"
                        ,"quantity": "2" ,"price": "126.50" ,"freight": "10.00" ,"premium": "0.50" ,"pack_charges":
                        "1.00" ,"other_charges": "0.00" ,"order_sum": "0.00" ,"collect_moneytype": "CNY"
                        ,"collect_sum": "12.00" ,"remark": "请勿摔货" }]
                    </div>
                    <div class="Countdiv">
                        { "id": "130520142013234" ,"type": "" ,"tradeid": "2701843" ,"mailno": "1000000000016"
                        ,"sender": { "id": "130520142010" ,"name": "李琳" ,"company": "新南电子商务有限公司" ,"mobile":
                        "13912345678" ,"phone": "021-87654321" ,"area": "310118" ,"city": "上海市,上海市,青浦区"
                        ,"address": "华新镇华志路123号" ,"zipcode": "610012" ,"email": "ll@abc.com" ,"im": "1924656234"
                        ,"starttime": "2013-05-20 12:00:00" ,"endtime": "2013-05-20 15:00:00" } ,"receiver":
                        { "id": "130520142097" ,"name": "杨逸嘉" ,"company": "逸嘉实业有限公司" ,"mobile": "13687654321"
                        ,"phone": "010-22226789" ,"area": "501022" ,"city": "四川省,成都市,武侯区" ,"address": "育德路497号"
                        ,"zipcode": "610012" ,"email": "yyj@abc.com" ,"im": "yangyijia-abc" } ,"items":
                        [ { "id": "1234567" ,"name": "迷你风扇" ,"category": "电子产品" ,"material": "金属" ,"size":
                        "12,11,23" ,"weight": "0.752" ,"unitprice": "79" ,"url": "http://www.abc.com/123.html"
                        ,"quantity": "1" ,"remark": "黑色大号" } ,{ "name": "USB3.0集线器" ,"quantity": "1" ,"remark":
                        "" } ] ,"weight": "0.753" ,"size": "12,23,11" ,"quantity": "2" ,"price": "126.50"
                        ,"freight": "10.00" ,"premium": "0.50" ,"pack_charges": "1.00" ,"other_charges":
                        "0.00" ,"order_sum": "0.00" ,"collect_moneytype": "CNY" ,"collect_sum": "12.00"
                        ,"remark": "请勿摔货" }
                    </div>
                    <div class="Countdiv">
                        { "id": "ZTO-130520142013234" ,"remark": "收货人出差了，过几天后再发" }
                    </div>
                    <div class="Countdiv">
                        { "lastno": "100000000016" }
                    </div>
                    <div class="Countdiv">
                        { "number": "10" ,"lastno": "100000000016" }
                    </div>
                    <div class="Countdiv">
                        { "mailno":"718595286704" }
                    </div>
                    <div class="Countdiv">
                        { "mailno":"718595286704","isall":"false" }
                    </div>
                </td>
            </tr>
               <tr>
                <td>
                    请求的内容编码串：
                </td>
                <td>
                    <textarea  style="width: 700px; height: 150px;" id="content" name="content"></textarea>
                </td>
            </tr>
            <tr>
                <td>
                    请求的校验加密串：
                </td>
                <td>
                    <input type="text" id="verify" name="verify" value="" />
                </td>
            </tr>


      <tr>
                <td>
                    请求的返回结果：
                </td>
                <td>
				    <textarea  style="width: 700px; height: 150px;" id="result" name="result"></textarea>
                </td>
            </tr>

        </tbody></table>
    <input type="button" value="生成请求串及获得请求结果" onclick="BaseCountCode()" />
</form>
<script type="text/javascript">
 $(function() {
     SeleChange();
 })
 function SeleChange() {
    var length = $("#func")[0].options.length - 1;    
    for(var i = length; i >= 0; i--){    
        if($("#func")[0].options[i].selected == true){    
            count=i; 
            break;   
        }    
    }   
    $("#contentM").val($(".Countdiv").eq(count).html());
 }

function BaseCountCode() {
	var style = $("#style").val();
	var pwd = $("#pwd").val();
	var content = $("#contentM").val();
	var func = $("#func").val();
	var partner= $("#partner").val();
	var datetime= $("#datetime").val();
	
	$.post("service.php",
		{ "style": style, "pwd": pwd, "content": content, "func": func , "partner": partner , "datetime": datetime },
		function (result) {
		 if(result.status='OK')
			{
			$("#content").val(result.content);
			$("#verify").val(result.verify);
			  $("#result").val(result.result);
			}
		}, "json");
}
</script>
</body>
</html>